﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApp_91
{
    /// <summary>
    /// Lógica de interacción para BuscarClienteHapkido.xaml
    /// </summary>
    public partial class BuscarClienteHapkido : Window
    {
        public BuscarClienteHapkido()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            comboBox1.Items.Insert(0, "Seleccione Filtro");
            comboBox1.Items.Insert(1, "Nombre");
            comboBox1.Items.Insert(2, "Apellido");
            comboBox1.Items.Insert(3, "Instructor");
            comboBox1.SelectedIndex = 0;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            string cliente = textBox1.Text;
            if (comboBox1.Text == "Nombre")
            {
                dataGrid1.DataContext = acceso.operaciones.CargarDataGrid("select * from Cliente WHERE Nombre = '" + cliente + "'");
            }
            else
            {
                if (comboBox1.Text == "Apellido")
                {
                    dataGrid1.DataContext = acceso.operaciones.CargarDataGrid("select * from Cliente WHERE Apellido = '" + cliente + "'");
                }
                else
                {
                    dataGrid1.DataContext = acceso.operaciones.CargarDataGrid("select * from Cliente WHERE Profesor = '" + cliente + "'");

                }

            }
        }
    }
}
